/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Principal.java
 *
 * Created on 18/06/2011, 10:01:58
 */
package br.unesp.demac.bcc.soo.view;

import br.unesp.demac.bcc.soo.bean.Funcionario;
import br.unesp.demac.bcc.soo.util.FrameUtil;
import br.unesp.demac.bcc.soo.view.aluguel.JIFRegistrarAluguel;
import br.unesp.demac.bcc.soo.view.aluguel.JIFRegistrarDevolucao;
import br.unesp.demac.bcc.soo.view.cadastro.JIFCliente;
import br.unesp.demac.bcc.soo.view.cadastro.JIFDvd;
import br.unesp.demac.bcc.soo.view.cadastro.JIFFuncionario;
import br.unesp.demac.bcc.soo.view.cadastro.JIFModalidade;
import br.unesp.demac.bcc.soo.view.relatorio.JIFFilmesAlugados;
import br.unesp.demac.bcc.soo.view.relatorio.JIFFilmesEmAtraso;
import br.unesp.demac.bcc.soo.view.relatorio.JIFFilmesMaisAlugados;
import br.unesp.demac.bcc.soo.view.relatorio.JIFHistoricoDeAlugueis;
import br.unesp.demac.bcc.soo.view.sobre.JIFLocadora;

/**
 *
 * @author flavioam
 */
public class JFPrincipal extends javax.swing.JFrame {
    
    private Funcionario funcionarioLogado;

    /** Creates new form Principal */
    public JFPrincipal(Funcionario f) {
        funcionarioLogado = f;
        initComponents();
        if (funcionarioLogado.getPerfil().compareToIgnoreCase("admin") == 0) {
            meiFuncionario.setEnabled(true);
        }
        FrameUtil.centralizar(this);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        desktopPane = new javax.swing.JDesktopPane();
        mebPrincipal = new javax.swing.JMenuBar();
        menCadastro = new javax.swing.JMenu();
        meiCliente = new javax.swing.JMenuItem();
        meiDvd = new javax.swing.JMenuItem();
        meiFuncionario = new javax.swing.JMenuItem();
        meiModalidade = new javax.swing.JMenuItem();
        menAluguel = new javax.swing.JMenu();
        meiAluguel = new javax.swing.JMenuItem();
        meiDevolucao = new javax.swing.JMenuItem();
        menRelatorios = new javax.swing.JMenu();
        meiAlugados = new javax.swing.JMenuItem();
        meiAtraso = new javax.swing.JMenuItem();
        meiMaisAlugados = new javax.swing.JMenuItem();
        meiHistorico = new javax.swing.JMenuItem();
        menSobre = new javax.swing.JMenu();
        meiLocadora = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema Locadora - SOO 2011 Noturno");

        menCadastro.setText("Cadastro");
        menCadastro.setFont(new java.awt.Font("Tahoma", 0, 18));

        meiCliente.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, java.awt.event.InputEvent.CTRL_MASK));
        meiCliente.setFont(new java.awt.Font("Tahoma", 0, 18));
        meiCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/unesp/demac/bcc/soo/img/ico16x16/customer.png"))); // NOI18N
        meiCliente.setText("Cliente");
        meiCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                meiClienteActionPerformed(evt);
            }
        });
        menCadastro.add(meiCliente);

        meiDvd.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F6, java.awt.event.InputEvent.CTRL_MASK));
        meiDvd.setFont(new java.awt.Font("Tahoma", 0, 18));
        meiDvd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/unesp/demac/bcc/soo/img/ico16x16/dvd-green.png"))); // NOI18N
        meiDvd.setText("Dvd");
        meiDvd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                meiDvdActionPerformed(evt);
            }
        });
        menCadastro.add(meiDvd);

        meiFuncionario.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F7, java.awt.event.InputEvent.CTRL_MASK));
        meiFuncionario.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        meiFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/unesp/demac/bcc/soo/img/ico16x16/employee.png"))); // NOI18N
        meiFuncionario.setText("Funcionário");
        meiFuncionario.setEnabled(false);
        meiFuncionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                meiFuncionarioActionPerformed(evt);
            }
        });
        menCadastro.add(meiFuncionario);

        meiModalidade.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F8, java.awt.event.InputEvent.CTRL_MASK));
        meiModalidade.setFont(new java.awt.Font("Tahoma", 0, 18));
        meiModalidade.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/unesp/demac/bcc/soo/img/ico16x16/gold.png"))); // NOI18N
        meiModalidade.setText("Modalidade");
        meiModalidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                meiModalidadeActionPerformed(evt);
            }
        });
        menCadastro.add(meiModalidade);

        mebPrincipal.add(menCadastro);

        menAluguel.setText("Aluguel");
        menAluguel.setFont(new java.awt.Font("Tahoma", 0, 18));

        meiAluguel.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F8, java.awt.event.InputEvent.CTRL_MASK));
        meiAluguel.setFont(new java.awt.Font("Tahoma", 0, 18));
        meiAluguel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/unesp/demac/bcc/soo/img/ico16x16/outIcon.png"))); // NOI18N
        meiAluguel.setText("Registrar Aluguel");
        meiAluguel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                meiAluguelActionPerformed(evt);
            }
        });
        menAluguel.add(meiAluguel);

        meiDevolucao.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F9, java.awt.event.InputEvent.CTRL_MASK));
        meiDevolucao.setFont(new java.awt.Font("Tahoma", 0, 18));
        meiDevolucao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/unesp/demac/bcc/soo/img/ico16x16/inIcon.png"))); // NOI18N
        meiDevolucao.setText("Registrar Devolução");
        meiDevolucao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                meiDevolucaoActionPerformed(evt);
            }
        });
        menAluguel.add(meiDevolucao);

        mebPrincipal.add(menAluguel);

        menRelatorios.setText("Relatórios");
        menRelatorios.setFont(new java.awt.Font("Tahoma", 0, 18));

        meiAlugados.setFont(new java.awt.Font("Tahoma", 0, 18));
        meiAlugados.setText("Filmes Alugados");
        meiAlugados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                meiAlugadosActionPerformed(evt);
            }
        });
        menRelatorios.add(meiAlugados);

        meiAtraso.setFont(new java.awt.Font("Tahoma", 0, 18));
        meiAtraso.setText("Filmes em Atraso");
        meiAtraso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                meiAtrasoActionPerformed(evt);
            }
        });
        menRelatorios.add(meiAtraso);

        meiMaisAlugados.setFont(new java.awt.Font("Tahoma", 0, 18));
        meiMaisAlugados.setText("Filmes Mais Alugados");
        meiMaisAlugados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                meiMaisAlugadosActionPerformed(evt);
            }
        });
        menRelatorios.add(meiMaisAlugados);

        meiHistorico.setFont(new java.awt.Font("Tahoma", 0, 18));
        meiHistorico.setText("Histórico de Aluguéis");
        meiHistorico.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                meiHistoricoActionPerformed(evt);
            }
        });
        menRelatorios.add(meiHistorico);

        mebPrincipal.add(menRelatorios);

        menSobre.setText("Sobre");
        menSobre.setFont(new java.awt.Font("Tahoma", 0, 18));
        menSobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menSobreActionPerformed(evt);
            }
        });

        meiLocadora.setText("Locadora");
        menSobre.add(meiLocadora);

        mebPrincipal.add(menSobre);

        setJMenuBar(mebPrincipal);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void meiClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_meiClienteActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFCliente());  
    }//GEN-LAST:event_meiClienteActionPerformed

    private void meiFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_meiFuncionarioActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFFuncionario());  
    }//GEN-LAST:event_meiFuncionarioActionPerformed

    private void meiModalidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_meiModalidadeActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFModalidade()); 
    }//GEN-LAST:event_meiModalidadeActionPerformed

    private void meiDvdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_meiDvdActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFDvd()); 
    }//GEN-LAST:event_meiDvdActionPerformed

    private void meiAluguelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_meiAluguelActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFRegistrarAluguel()); 
    }//GEN-LAST:event_meiAluguelActionPerformed

    private void meiDevolucaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_meiDevolucaoActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFRegistrarDevolucao()); 
    }//GEN-LAST:event_meiDevolucaoActionPerformed

    private void meiAlugadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_meiAlugadosActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFFilmesAlugados()); 
    }//GEN-LAST:event_meiAlugadosActionPerformed

    private void meiAtrasoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_meiAtrasoActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFFilmesEmAtraso()); 
    }//GEN-LAST:event_meiAtrasoActionPerformed

    private void meiMaisAlugadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_meiMaisAlugadosActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFFilmesMaisAlugados()); 
    }//GEN-LAST:event_meiMaisAlugadosActionPerformed

    private void meiHistoricoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_meiHistoricoActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFHistoricoDeAlugueis()); 
    }//GEN-LAST:event_meiHistoricoActionPerformed

    private void menSobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menSobreActionPerformed
        // TODO add your handling code here:
        FrameUtil.adicionarFrame(desktopPane, new JIFLocadora()); 
    }//GEN-LAST:event_menSobreActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JDesktopPane desktopPane;
    private javax.swing.JMenuBar mebPrincipal;
    private javax.swing.JMenuItem meiAlugados;
    private javax.swing.JMenuItem meiAluguel;
    private javax.swing.JMenuItem meiAtraso;
    private javax.swing.JMenuItem meiCliente;
    private javax.swing.JMenuItem meiDevolucao;
    private javax.swing.JMenuItem meiDvd;
    private javax.swing.JMenuItem meiFuncionario;
    private javax.swing.JMenuItem meiHistorico;
    private javax.swing.JMenuItem meiLocadora;
    private javax.swing.JMenuItem meiMaisAlugados;
    private javax.swing.JMenuItem meiModalidade;
    private javax.swing.JMenu menAluguel;
    private javax.swing.JMenu menCadastro;
    private javax.swing.JMenu menRelatorios;
    private javax.swing.JMenu menSobre;
    // End of variables declaration//GEN-END:variables
}
